Remove rustc::existing_doc_keyword lint#134202
Conversation
|
Details in individual commits. |
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
This comment has been minimized.
This comment has been minimized.
7a0a3f2 to
353aff4
Compare
|
Some changes occurred in GUI tests. |
This comment has been minimized.
This comment has been minimized.
| } | ||
|
|
||
| #[doc(keyword = "CookieMonster")] | ||
| #[doc(keyword = "auto")] |
There was a problem hiding this comment.
The test now fails if the value isn't a valid keyword.
There was a problem hiding this comment.
Well, that brings this question: why this change?
There was a problem hiding this comment.
Previously the "is it a valid keyword?" test was done by the lint. It has now moved to check_doc_keyword and it runs in several test cases where the lint did not.
There was a problem hiding this comment.
No I mean, doc(keyword) was voluntarily left "open" in what kind of keyword we could define. You changed this behaviour. That's the part I don't understand. I don't mind changing it away from being a lint.
There was a problem hiding this comment.
The lint checked this:
fn is_doc_keyword(s: Symbol) -> bool {
s <= kw::Union
}That hasn't changed (well, sym::SelfTy is now also accepted, for the exception). What has changed is how often this check is being applied.
| //@ !has "$.index[*][?(@.name=='hello')]" | ||
| //@ !has "$.index[*][?(@.name=='bar')]" | ||
| #[doc(keyword = "hello")] | ||
| #[doc(keyword = "break")] |
|
@GuillaumeGomez: the It seems like I should just be able to change
Keywords that are similar to I have viewed the generated docs in a browser. They always work fine no matter what keyword I use, and the search always works as expected. So I'm baffled. I just want to change |
| // Waiting for the search results to appear... | ||
| wait-for: "#search-tabs" | ||
| assert-text: (".result-keyword .result-name", "keyword CookieMonster") | ||
| assert-text: (".result-keyword .result-name", "keyword auto") |
There was a problem hiding this comment.
It's checking here the first search result. Considering that auto might not be the first item, we'll need to tweak it a bit.
There was a problem hiding this comment.
I checked for that, auto is the first item. ZookieMonster was too, as were a bunch of other things I tried.
| // Checks that the "keyword" results have the expected text alongside them. | ||
| go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" | ||
| write-into: (".search-input", "CookieMonster") | ||
| write-into: (".search-input", "auto") |
There was a problem hiding this comment.
try:
| write-into: (".search-input", "auto") | |
| write-into: (".search-input", "keyword:auto") |
Also you can open the generated docs with a web browser with build/[arch]/tests/rustdoc-gui/doc/lib2/index.html and test it manually.
There was a problem hiding this comment.
I'll try the keyword change on Monday. I did already try testing manually in a browser, it always worked fine no matter what I tried. That's why it was so baffling why some things worked but most didn't -- I could find an explanation to explain the success/failure differences.
|
Found the issue in |
|
I pushed a fix to your branch. To keep the |
|
Thank you! It was the |
|
I'm happy for this to merge if you are. |
|
I am too so let's go! @bors r=GuillaumeGomez,nnethercote |
…d, r=GuillaumeGomez,nnethercote Remove `rustc::existing_doc_keyword` lint The check doesn't require a lint. r? `@GuillaumeGomez`
…llaumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#134111 (Fix `--nocapture` for run-make tests) - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134314 (Make sure to use normalized ty for unevaluated const in default struct value) - rust-lang#134329 (Add m68k_target_feature) - rust-lang#134342 (crashes: more tests) - rust-lang#134354 (Handle fndef rendering together with signature rendering) Failed merges: - rust-lang#133265 (Add a range argument to vec.extract_if) r? `@ghost` `@rustbot` modify labels: rollup
…d, r=GuillaumeGomez,nnethercote Remove `rustc::existing_doc_keyword` lint The check doesn't require a lint. r? ``@GuillaumeGomez``
…d, r=GuillaumeGomez,nnethercote Remove `rustc::existing_doc_keyword` lint The check doesn't require a lint. r? ```@GuillaumeGomez```
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134354 (Handle fndef rendering together with signature rendering) - rust-lang#134368 (Use links to edition guide for edition migrations) - rust-lang#134371 (Check for array lengths that aren't actually `usize`) - rust-lang#134378 (An octuple of polonius fact generation cleanups) Failed merges: - rust-lang#134365 (Rename `rustc_mir_build::build` to `builder`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134354 (Handle fndef rendering together with signature rendering) - rust-lang#134368 (Use links to edition guide for edition migrations) - rust-lang#134371 (Check for array lengths that aren't actually `usize`) - rust-lang#134378 (An octuple of polonius fact generation cleanups) Failed merges: - rust-lang#134365 (Rename `rustc_mir_build::build` to `builder`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#134202 (Remove `rustc::existing_doc_keyword` lint) - rust-lang#134354 (Handle fndef rendering together with signature rendering) - rust-lang#134368 (Use links to edition guide for edition migrations) - rust-lang#134371 (Check for array lengths that aren't actually `usize`) - rust-lang#134378 (An octuple of polonius fact generation cleanups) Failed merges: - rust-lang#134365 (Rename `rustc_mir_build::build` to `builder`) r? `@ghost` `@rustbot` modify labels: rollup
aDotInTheVoid
left a comment
There was a problem hiding this comment.
@bors r- until rustdoc-json text fixed.
|
@bors r- |
All the other unconditional keywords are in the alphabetical order, but `while` is for some reason not.
`CheckAttrVisitor::check_doc_keyword` checks `#[doc(keyword = "..")]` attributes to ensure they are on an empty module, and that the value is a non-empty identifier. The `rustc::existing_doc_keyword` lint checks these attributes to ensure that the value is the name of a keyword. It's silly to have two different checking mechanisms for these attributes. This commit does the following. - Changes `check_doc_keyword` to check that the value is the name of a keyword (avoiding the need for the identifier check, which removes a dependency on `rustc_lexer`). - Removes the lint. - Updates tests accordingly. There is one hack: the `SelfTy` FIXME case used to used to be handled by disabling the lint, but now is handled with a special case in `is_doc_keyword`. That hack will go away if/when the FIXME is fixed. Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
bdbaeae to
121e87b
Compare
|
@bors r=GuillaumeGomez |
The check doesn't require a lint.
r? @GuillaumeGomez